﻿Option Strict On
Option Explicit On
Option Infer On

Imports System
Imports Microsoft.VisualBasic.ControlChars
Imports GenDotNet.TemplateSupport
Imports GenDotNet.Task.Common
Imports GenDotNet.TemplateSupport.Strings
Imports GenDotNet.ObjectModel

Namespace VB
   Public Module NetTypeExtensions
      <System.Runtime.CompilerServices.Extension()> _
      Public Function OutputAlias(ByVal type As StandardNetType) As String
         Select Case type
            Case StandardNetType.Int16
               Return "Short"
            Case StandardNetType.Int32
               Return "Integer"
            Case StandardNetType.Int64
               Return "Long"
            Case StandardNetType.DateTime
               Return "Date"
            Case StandardNetType.Uint64
               Return "ULong"
            Case StandardNetType.UInt32
               Return "UInteger"
            Case StandardNetType.Object
               Return "Object"
            Case Else
               Dim out = type.Output
               If out.StartsWith("System.", StringComparison.InvariantCultureIgnoreCase) Then
                  ' TODO: Supply a ReplaceIgnoreCase and change the following method
                  out.Replace("System.", String.Empty)
               End If
               Return out
         End Select
      End Function

   End Module
End Namespace

Namespace CSharp
   Public Module NetTypeExtensions
      '<System.Runtime.CompilerServices.Extension()> _
      'Public Function Output(ByVal type As StandardNetType) As String
      '   Select Case type
      '      Case StandardNetType.Int16
      '         Return "Int16"
      '      Case StandardNetType.Int32
      '         Return "Int32"
      '      Case StandardNetType.Int64
      '         Return "Int64"
      '      Case StandardNetType.DateTime
      '         Return "DateTime"
      '      Case StandardNetType.UnsignedLong
      '         Return "UInt64"
      '      Case StandardNetType.Boolean
      '         Return "Boolean"
      '      Case StandardNetType.Guid
      '         Return "System.Guid"
      '      Case Else
      '         Return "Unknown Type"
      '   End Select
      'End Function

      <System.Runtime.CompilerServices.Extension()> _
      Public Function OutputAlias(ByVal type As StandardNetType) As String
         Select Case type
            Case StandardNetType.String
               Return "string"
            Case StandardNetType.Boolean
               Return "bool"
            Case StandardNetType.Int16
               Return "short"
            Case StandardNetType.Int32
               Return "int"
            Case StandardNetType.Int64
               Return "long"
            Case StandardNetType.Uint64
               Return "ulong"
            Case StandardNetType.UInt32
               Return "uint"
            Case Else
               Return type.Output
         End Select
      End Function

      '<System.Runtime.CompilerServices.Extension()> _
      'Public Function ShortName(ByVal type As StandardNetType) As String
      '   If type.Output.StartsWith("System.") Then
      '      Return type.Output.Replace("System.", "")
      '   End If
      '   Return type.Output
      'End Function
   End Module
End Namespace

